package simpleFactory;

public class SimpleFactoryTest {
//    private Object returnOp;
    private final double num1, num2;

    public SimpleFactoryTest(double num1, double num2){
        this.num1 = num1;
        this.num2 = num2;
    }

    public Operation Calculator(String op){
        switch(op){
            case "+": return new OperationAdd(num1, num2);
            case "-": return new OperationSub(num1, num2);
            case "*": return new OperationMul(num1, num2);
            case "/": return new OperationDiv(num1, num2);
            default: return new Operation(num1, num2);
        }
    }
    //客户端
    /*public static void main(String[] args) {
        SimpleFactoryTest test = new SimpleFactoryTest(1,2);
        System.out.println(test.Calculator("+").ops());
    }*/
}
